package com.sjc.cat.rule.controller;

import com.sjc.cat.common.util.R;
import com.sjc.cat.rule.controller.form.EstimateOrderChargeForm;
import com.sjc.cat.rule.servise.ChargeRuleService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.HashMap;

/**
 * @Author: pineee
 * @CreateTime: 2023-10-19 15:00
 * @Version: 1.0.0
 */
@RestController
@RequestMapping("/charge")
public class ChargeRuleController {

    @Resource
    private ChargeRuleService chargeRuleService;

    /*
     * @author: pineee
     * @param: [form]
     * @return: com.sjc.cat.common.util.R
     *
     * 预估代驾费用
     **/
    @PostMapping("/estimateOrderCharge")
    public R estimateOrderCharge(@RequestBody @Valid EstimateOrderChargeForm form){
        HashMap map = chargeRuleService.calculateOrderCharge(form.getMileage(), form.getTime(), 0, null);
        return R.ok().put("result",map);
    }
}
